package com.tian.hello

import com.tian.arch.BuildConfig
import com.tian.arch.DefaultGlobalConfig
import com.tian.arch.GlobalConfig
import com.tian.arch.base.BaseApplication
import com.tian.arch.config.INetworkConfigPolicy
import com.tian.arch.config.NetworkPolicyProvider

/**
 * Created by elvis on 2016/11/19.
 * 自定义Application
 */
class MyApplication : BaseApplication() {
    override fun initGlobalConfig(): GlobalConfig {
        return DefaultGlobalConfig.customConfig {
            it.networkPolicyProvider = object : NetworkPolicyProvider {
                override fun createNetworkPolicy(): INetworkConfigPolicy {
                    return object : INetworkConfigPolicy {
                        private val rootUrl = "https://gateway-test.53zaixian.com/"
                        override fun getPolicyName(): String {
                            return BuildConfig.BUILD_TYPE
                        }

                        override fun getPolicyDomain(): String {
                            return rootUrl
                        }
                    }
                }
            }
            it
        }
    }
}


